//index.js

const http = require("../../models/https")

//获取应用实例
const app = getApp()
Page({
  data: {
    value:""
  },
  onLoad: function () {
    http({
      url:`http://47.113.104.50:3000/top/playlist?cat=%E5%8D%8E%E8%AF%AD&limit=15&offset=0`,
      success:res=>{
        console.log(res.data.playlists);
        this.setData({
          value:res.data.playlists
        })
      }
    })
  },
  // 上拉刷新
  onReachBottom(){
    console.log(long);
    http({
      url:`http://47.113.104.50:3000/top/playlist?cat=%E5%8D%8E%E8%AF%AD&limit=15&offset=${long}`,
      success:res=>{
        console.log(res.data.playlists);
        this.setData({
          value:[...this.data.value,...res.data.playlists]
        })
      }
    })
  },
  //跳转
  onGoto(event){
    let id = event.currentTarget.dataset.id
    wx.navigateTo({
      url: `../detail/detail?id=${id}`,
    })
  }
})
